' One Check is a program by David Ahl from his book: "Basic Computer Games Microcomputer Edition" 
' As found at https://archive.org/details/Basic_Computer_Games_Microcomputer_Edition_1978_Creative_Computing

' This BASIC Anywhere Machine port (modded just enough to get the program easily working) by Charlie
' is based on another version of David Ahl's program found at https://hwiegman.home.xs4all.nl/gw-games/1CHECK.BAS.html
' ' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.08.01.01.58]) on 2023.08.04 at 22:45 (Coordinated Universal Time)

SCREEN 12
COLOR 14
5 PRINT
10 PRINT "SOLITAIRE CHECKER PUZZLE BY DAVID AHL"
15 PRINT
20 PRINT "48 CHECKERS ARE PLACED ON THE 2 OUTSIDE SPACES OF A"
25 PRINT "STANDARD 64-SQUARE CHECKERBOARD.  THE OBJECT IS TO"
30 PRINT "REMOVE AS MANY CHECKERS AS POSSIBLE BY DIAGONAL JUMPS"
35 PRINT "(AS IN STANDARD CHECKERS).  USE THE NUMBERED BOARD TO"
40 PRINT "INDICATE THE SQUARE YOU WISH TO JUMP FROM AND TO.  ON"
45 PRINT "THE BOARD PRINTED OUT ON EACH TURN '1' INDICATES A"
50 PRINT "CHECKER AND '0' AN EMPTY SQUARE.  WHEN YOU HAVE NO"
55 PRINT "POSSIBLE JUMPS REMAINING, INPUT A '0' IN RESPONSE TO"
60 PRINT "QUESTION 'JUMP FROM ?'"
62 PRINT
PRINT "PRESS ANY KEY TO CONTINUE"
SLEEP
65 ' PRINT "HERE IS THE NUMERICAL BOARD:"
66 ' PRINT
68 DIM A(64) 
70 ' FOR J=1 TO 57 STEP 8
72 ' B$="## ##  ##  ##  ##  ##  ##  ##"
74 ' PRINT USING B$;J,J+1,J+2,J+3,J+4,J+5,J+6,J+7
76 ' NEXT J
77 ' PRINT
78 ' PRINT "AND HERE IS THE OPENING POSITION OF THE CHECKERS:"
80 FOR J=1 TO 64
82 A(J)=1
84 NEXT J
86 FOR J=19 TO 43 STEP 8
88 FOR I=J TO J+3
90 A(I)=0
92 NEXT I
94 NEXT J
96 M=0
98 GOTO PrintTheBoard ' 340
100 INPUT "JUMP FROM: ";F
105 IF F=0 THEN 500
110 INPUT "TO: ";T
112 PRINT
118 REM *** CHECK LEGALITY OF MOVE
120 F1=INT((F-1)/8)
130 F2=F-8*F1
140 T1=INT((T-1)/8)
150 T2=T-8*T1
160 IF F1>7 THEN 230
170 IF T1>7 THEN 230
180 IF F2>8 THEN 230
190 IF T2>8 THEN 230
200 IF ABS(F1-T1)<>2 THEN 230
210 IF ABS(F2-T2)<>2 THEN 230
212 IF A((T+F)/2)=0 THEN 230
215 IF A(F)=0 THEN 230
220 IF A(T)=1 THEN 230
225 GOTO 250
230 PRINT "ILLEGAL MOVE.  TRY AGAIN..."
240 GOTO 100
245 REM *** UPDATE BOARD
250 A(T)=1
260 A(F)=0
270 A((T+F)/2)=0
290 M=M+1

310 REM *** PRINT BOARD
PrintTheBoard:
CLS
 PRINT "HERE IS THE NUMERICAL BOARD:"
 PRINT
 FOR J=1 TO 57 STEP 8
 B$="## ##  ##  ##  ##  ##  ##  ##"
 PRINT USING B$;J,J+1,J+2,J+3,J+4,J+5,J+6,J+7
 NEXT J
 PRINT
 PRINT "AND HERE ARE THE POSITIONS OF THE CHECKERS:"

340 FOR J=1 TO 57 STEP 8
350 FOR I=J TO J+7
360 PRINT A(I) + " ";
370 NEXT I
380 PRINT
390 NEXT J
400 PRINT
410 GOTO 100
490 REM *** END GAME SUMMARY
500 S=0
510 FOR I=1 TO 64
520 S=S+A(I)
530 NEXT I
535 PRINT
540 PRINT "YOU MADE " + M + " JUMPS AND HAD " + S + " PIECES"
550 PRINT "REMAINING ON THE BOARD."
560 PRINT
562 INPUT "TRY AGAIN? ('Y' OR 'N')";A$
570 IF ucase$(A$)="Y" THEN 70
575 IF ucase$(A$)="N" THEN 600
580 PRINT "PLEASE ANSWER 'Y' OR 'N'."
590 GOTO 562
600 PRINT
610 PRINT "O.K.  HOPE YOU HAD FUN!"
999 END